import {createApp} from 'vue'
import {createPinia} from 'pinia'
import {
    ActionBar,
    ActionBarIcon,
    ActionBarButton,
    Divider,
    Popup,
    Overlay,
    Loading,
    Dialog,
    ContactCard,
    Form,
    AddressEdit,
    AddressList,
    Field,
    CellGroup,
    Cell,
    SwipeCell,
    Icon,
    Stepper,
    Card,
    Checkbox,
    CheckboxGroup,
    Button,
    Swipe,
    SwipeItem,
    PullRefresh,
    List,
    Tab,
    Tabs,
    SubmitBar,
    Toast,
    Skeleton
} from 'vant'

import App from './App.vue'
import router from './router'
import 'lib-flexible/flexible'
import './assets/main.css'
import './common/style/theme.css'
import 'vant/es/toast/style'
import 'vant/es/notify/style'
// 确认框同理，其它不显示的样式同理引入相关css即可
import 'vant/es/dialog/style'
const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(ActionBarButton)
    .use(ActionBarIcon)
    .use(ActionBar)
    .use(Divider)
    .use(Popup)
    .use(Overlay)
    .use(Loading)
    .use(Dialog)
    .use(Toast)
    .use(ContactCard)
    .use(Form)
    .use(AddressEdit)
    .use(AddressList)
    .use(Field)
    .use(CellGroup)
    .use(Cell)
    .use(SwipeCell)
    .use(Icon)
    .use(Stepper)
    .use(Card)
    .use(Button)
    .use(Swipe)
    .use(SwipeItem)
    .use(PullRefresh)
    .use(List)
    .use(Tab)
    .use(Tabs)
    .use(SubmitBar)
    .use(Checkbox)
    .use(CheckboxGroup)
    .use(Skeleton)

// 全局过滤器
app.config.globalProperties.$filters = {
    prefix(url) {
        let prefix = import.meta.env.MODE === 'development' ? 'http://mall.keliqee.cn' : 'http://www.keliqee.cn'
        if (url && url.startsWith('http')) {
            return url
        } else {
            return prefix+url
        }
    }
}

app.mount('#app')
